#!/bin/sh

t=0

s=0

for i in `seq 136`
do
  echo Attempting to solve board $i

  ./sokoban 130.237.218.85 7781 $i &

  t=0

  for t in `seq 60`
  do
    if [ ! `pidof -s sokoban` ] # sokoban doesnt exist anymore
    then
      echo Board SOLVED in $t seconds
      s=$((s+1))
      break
    fi

    sleep 1
  done

  if [ `pidof -s sokoban` ]
  then
    killall sokoban
    echo Board FAILED
  fi
done

echo solving $s boards out of 136
